# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=libde265
pkgver=1.0.4
pkgrel=0
pkgdesc="Open h.265 video codec implementation"
url="https://github.com/strukturag/libde265"
arch="all"
license="LGPL-3.0-or-later"
makedepends="autoconf automake libtool"
options="!check"  # no tests provided
subpackages="$pkgname-dev"
source="https://github.com/strukturag/libde265/releases/download/v$pkgver/libde265-$pkgver.tar.gz
	export-only-decoder-api.patch
	disable-tools.patch
	use-new-ffmpeg-enum-names.patch
	"

prepare() {
	default_prepare
	autoreconf -fvi
}

build() {
	# This is en/decoder, so performance matters more than size.
	export CPPFLAGS="${CPPFLAGS/-Os/-O2}"
	export CXXFLAGS="${CXXFLAGS/-Os/-O2}"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--disable-sherlock265
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="1c57a0b543d17a09928ce126b957b71d3d92add24936f724767d0fff13a137036e9b053fb3aaa6f8f9c5e3e60cb76d9ad816384a7bb626f7fe0cd1aad6d13ec1  libde265-1.0.4.tar.gz
b937024655020eaea60cc02110018a4b8a63c7fca5a3c14cf042952e6acc83cf39d8d5a23d16536738a374538e2a20c8130d62e0e82a2dbd86ccea9a01433d11  export-only-decoder-api.patch
ec3d78eb5e0df13900fdc87711372de8dbf12371feeb885dd54e824b4e6370c8b19528ad1fe07aca410ab281665a64e1357d4ab88fc78fb68d2a9ebd18761bca  disable-tools.patch
6007f51114dcfaefed402ac88599add00f5a25d9e670f20e658d166843b4df3525e9f59556c50358fad85878d5bc2062616a1dede597f4664f46fe1f3baaef7d  use-new-ffmpeg-enum-names.patch"
